package com.guigu.tms.aggregation.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.guigu.tms.aggregation.service.ITransportOrderService;
import com.guigu.tms.commons.aggregation.entity.TransportOrder;
import com.guigu.tms.commons.aggregation.entity.TransportOrderQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 运单表 前端控制器
 * </p>
 *
 * @author wj
 * @since 2022-10-21
 */
@RestController
@RequestMapping("/transportOrder")
public class TransportOrderController {
    @Autowired
    private ITransportOrderService transportOrderService;

    @PostMapping("getTransportOrderByOrderIds")
    public List<TransportOrder> getTransportOrderByOrderIds(@RequestBody List<String> orderIds){
        QueryWrapper<TransportOrder> wrapper = new QueryWrapper<>();
        wrapper.in("order_id",orderIds);
        return transportOrderService.list(wrapper);
    }

    @PostMapping("getTransportOrders/{num}/{size}")
    public PageInfo<TransportOrder> getTransportOrders(@RequestBody TransportOrderQuery transportOrderQuery, @PathVariable("num") Integer num, @PathVariable("size")Integer size){
        return transportOrderService.getTransportOrders(transportOrderQuery, num, size);
    }
}
